import 'package:shared_preferences/shared_preferences.dart';

const keyTilePutMode = 'play_mode';
const keyTileMoveSound = 'move_sound';

late SharedPreferences _store;

Future<SharedPreferences> initSharedPreferences() async {
  _store = await SharedPreferences.getInstance();
  return _store;
}

///保存简单数据到本地
saveBool(String key, bool value) => _store.setBool(key, value);

saveDouble(String key, double value) => _store.setDouble(key, value);

saveInt(String key, int value) => _store.setInt(key, value);

saveString(String key, String value) => _store.setString(key, value);

saveStringList(String key, List<String> value) =>
    _store.setStringList(key, value);

///读取本地的简单数据
readBool(String key) => _store.getBool(key);

readDouble(String key) => _store.getDouble(key);

readInt(String key) => _store.getInt(key);

readString(String key) => _store.getString(key);

readStringList(String key) => _store.getStringList(key);

///移除本地的简单数据
removeValue(String key) => _store.remove(key);
